<?php

namespace app\web\model;

use think\Model;

class CreditCashWeb extends Model
{
    protected $table = 'sc_credit_cash';
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';


    public function getBankImgAttr($value)
    {
        return env('host').$value;
    }

    public function getSavingsCardNoAttr($value)
    {
        return substr($value, -4);
    }

    public function getCreatedAtAttr($value)
    {
        return datetime($value);
    }

    public function getPayTimeAttr($value)
    {
        return datetime($value);
    }

    public function lists($page_conf)
    {
        $data = $this->alias('c')
            ->field('b.bank_name,b.bank_img,c.savings_card_no,c.created_at,c.pay_time,c.amount,c.status')
            ->leftJoin('sc_credit_bank b', 'b.bank_id=c.savings_bank_id')
            ->order('')->paginate($page_conf);
        return $data;
    }
}
